﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

public partial class User_competition : System.Web.UI.Page
{
    myDataSetTableAdapters.CompetitionsTableAdapter comAdapter = new myDataSetTableAdapters.CompetitionsTableAdapter();
    myDataSetTableAdapters.PostsTableAdapter postAdapter = new myDataSetTableAdapters.PostsTableAdapter();
    protected void Page_Load(object sender, EventArgs e)
    {
        myDataSet.CompetitionsDataTable comTable = comAdapter.GetTop2();
        myDataSet.PostsDataTable postTable = postAdapter.GetTop3WinnersNewest();
        DataListCom.DataSource = comTable;
        DataListCom.DataBind();
        lblCompetition.Text = postTable.Rows[0]["title"].ToString();
        btnNamePost1.Text = postTable.Rows[0]["fullName"].ToString();
        btnNamePost2.Text = postTable.Rows[1]["fullName"].ToString();
        btnNamePost3.Text = postTable.Rows[2]["fullName"].ToString();
        btnNamePost1.NavigateUrl = "post_detail.aspx?id=" + postTable.Rows[0]["id"].ToString();
        btnNamePost2.NavigateUrl = "post_detail.aspx?id=" + postTable.Rows[1]["id"].ToString();
        btnNamePost3.NavigateUrl = "post_detail.aspx?id=" + postTable.Rows[2]["id"].ToString();
    }
}
